<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <link rel="stylesheet" href="<%=path %>/css2/index1.css" type="text/css"></link>
  <script type="text/javascript" src="<%=path %>/js/jquery-1.8.3.js"></script>
    <base href="<%=basePath%>">
    
    <title>My JSP 'list.jsp' starting page</title>
    <script type="text/javascript">
    function add(){
    	location.href="<%=path%>/work/toadd.controller";
    }
    function update(id){
    location.href="<%=path%>/work/toupdate.controller?id="+id;
    }	
    function addall(){
    location.href="<%=path%>/work/toaddall.controller";
    }
    </script>
	

  </head>
  
  <body>
  <form action="<%=request.getContextPath() %>/work/list.controller" method="post">
  		${hehe } ${xixi } ${hu }
  		<table border="1" width="400px">
  			
			<tr>
				<td>姓名</td>
				<td><input type="text" name="name" value="${user.name}"/></td>
			</tr>
			<tr>
				<td>年龄</td>
				<td><input type="text" name="age" value="${user.age}"/></td>
			</tr>
			<tr>
				<td>爱好</td>
				<td><input type="text" name="hobby" value="${user.hobby}"/></td>
			</tr>
			<tr>
				<td></td>
				<td><input type="submit" value="查询"/></td>
			</tr>
		</table>
		<br/>
  		<table>
  				<tr>
  						<td>编号</td>
  						<td>姓名</td>
  						<td>年龄</td>
  						<td>爱好</td>
  						<td>公司</td>
  						<td>职位</td>
  						<td>
  							<input type="button" value="添加" onclick="add()">
  							<input type="button" value="批量添加" onclick="addall()">
  						</td>
  				</tr>
  				<c:forEach var="s" items="${list }">
  				<tr>
  						<td>${s.id }</td>
  						<td>${s.name }</td>
  						<td>${s.age }</td>
  						<td>${s.hobby }</td>
  						<td>
  							<c:forEach var="company" items="${listCompany }">
  								<c:if test="${s.cid==company.cid }">${company.cname }</c:if>
  							</c:forEach>
  						</td>
  						<td>
  							<c:forEach var="position" items="${listPosition }">
  								<c:if test="${s.pid==position.pid }">${position.pname }</c:if>
  							</c:forEach>
  						</td>
  						<td>
  							<input type="button" value="修改" onclick="update(${s.id})">
  						</td>
  				</tr>
  				</c:forEach>
  				<tr>
  						<td colspan="21">
  							
  							共有${listCount }条数据
  							当前为${page }/${pageCount }
  							${first}
  							${prev}
  							${next}
  							${last}
  						</td>
  				</tr>
  		</table>
  		</form>
  </body>
</html>
